﻿@{
    ViewData["Title"] = "Professional";
}

<script>
    function saveConfig() {
        if (confirm("警告：" + "\n" + "\n" + "将会覆盖现有的Samba配置文件！" + "\n" + "\n" + "是否继续？")) {
            var password = prompt("请输入密码");
            if (password != null && password != "") {
                $.ajax({
                    url: "/Professional/SaveConfig",
                    type: "Post",
                    dataType: "json",
                    data: {
                        password: password,
                        configContent: $("#ConfigContent").val(),
                    },
                    success: function (result) {
                        if (result.success) {
                            alert("操作成功！ ");
                        }
                        else {
                            alert(result.massage);
                        }
                    }
                })
            }
        }
    }
</script>

<div class="container mt-3">
    <div class="panel panel-default" style="margin-top:20px">
        <div class="panel-heading">
            <strong>配置文件内容</strong>
        </div>

        <div class="form-group" style="margin-bottom:0">
            <textarea id="ConfigContent" rows="15" class="form-control" type="text" style="height:inherit">@Model.ConfigContent</textarea>
        </div>
    </div>

    @*<form class="form-horizontal" role="form">
            <div class="form-group">
                <label for="firstname" class="col-sm-2 control-label">管理员密码</label>
                <div class="col-sm-8">
                    <input id="Password" class="form-control" type="password" placeholder="请输入密码" />
                </div>
                <div class="col-sm-2">
                    <button class="btn btn-danger" onclick="saveConfig()">保存</button>
                </div>
            </div>
        </form>*@

    <button class="btn btn-danger" onclick="saveConfig()">保存</button>

</div>